/**
 * 日志
 * std::clog
 * 最好还是使用一些功能齐全的三方库
 * 如轻量易用的 plog
 * 
 */

#include <plog/Log.h> // Step1: include the headers
#include "plog/Initializers/RollingFileInitializer.h"

#include <iostream>
#include <string>

int main(int argc, char* argv[])
{
    std::string exePath = argv[0];
    std::size_t found = exePath.find_last_of("/\\");
    std::string currentDir = exePath.substr(0, found);
    std::string logPath = currentDir + "\\a.txt";
    std::cout << "logPath: " << logPath << std::endl;


    plog::init(plog::debug, logPath.data()); // Step2: initialize the logger

    // Step3: write log messages using a special macro
    // There are several log macros, use the macro you liked the most

    PLOGD << "Hello log!"; // short macro
    PLOG_DEBUG << "Hello log!"; // long macro
    PLOG(plog::debug) << "Hello log!"; // function-style macro
    
    // Also you can use LOG_XXX macro but it may clash with other logging libraries
    LOGD << "Hello log!"; // short macro
    LOG_DEBUG << "Hello log!"; // long macro
    LOG(plog::debug) << "Hello log!"; // function-style macro

    return 0;
}